package studio.raptor.extractor.segment.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import studio.raptor.extractor.segment.config.ServerConfig;
import studio.raptor.extractor.segment.dao.EventDao;
import studio.raptor.extractor.segment.dao.EventNodeDao;
import studio.raptor.extractor.segment.entity.EventNode;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by liuyong8 on 2017/7/28.
 */
@Service
public class EventNodeService {
    private static final Logger log = LoggerFactory.getLogger(EventNodeService.class);

    @Autowired
    private EventNodeDao eventNodeDao;

    public Map<String,String> findNodeInfosByKindId(Integer kindId) throws Exception{
        Map<String,String> eventNodeMap = new HashMap<>();
        List<EventNode> eventNodes = eventNodeDao.queryEventNodesByKindId(kindId);
        for (EventNode eventNode : eventNodes) {
            eventNodeMap.put(eventNode.getNodeName(),eventNode.getServerUrl());
        }
        return eventNodeMap;
    }
}
